package com.cloudsigns.factorymanager2.engineering.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.IdRes;
import android.text.TextUtils;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.bumptech.glide.Glide;
import com.cloudsigns.factorymanager2.BaseActivity;
import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.cusenum.CommonEnum;
import com.cloudsigns.factorymanager2.engineering.IView.INormalDailyFeedBackForInstallView;
import com.cloudsigns.factorymanager2.engineering.IView.IUnusualDailyFeedBackForInstallView;
import com.cloudsigns.factorymanager2.engineering.IView.IUnusualFeedBackForDamageView;
import com.cloudsigns.factorymanager2.engineering.IView.IUnusualFeedBackForLogisticsCargoView;
import com.cloudsigns.factorymanager2.engineering.IView.IUnusualFeedBackForLogisticsDelayView;
import com.cloudsigns.factorymanager2.engineering.IView.IUploadPhotoView;
import com.cloudsigns.factorymanager2.engineering.adapter.PopWindowAdapter;
import com.cloudsigns.factorymanager2.engineering.bean.DialogItemBean;
import com.cloudsigns.factorymanager2.engineering.bean.EngineeringInstallationOrderBean;
import com.cloudsigns.factorymanager2.engineering.customview.BottomListDialog;
import com.cloudsigns.factorymanager2.engineering.customview.SpinerPopWindow;
import com.cloudsigns.factorymanager2.engineering.presenter.NormalFeedBackForInstallPresenter;
import com.cloudsigns.factorymanager2.engineering.presenter.UnusualFeedBackForDamagePrsenter;
import com.cloudsigns.factorymanager2.engineering.presenter.UnusualFeedBackForInstallPrsenter;
import com.cloudsigns.factorymanager2.engineering.presenter.UnusualFeedBackForLogisticsCargoPrsenter;
import com.cloudsigns.factorymanager2.engineering.presenter.UnusualFeedBackForLogisticsDelayPrsenter;
import com.cloudsigns.factorymanager2.engineering.presenter.UploadPhotoPresenter;
import com.cloudsigns.factorymanager2.engineering.utils.PhotoUtil;
import com.cloudsigns.factorymanager2.event.EngineeringOrderDetailForTeamEvent;
import com.cloudsigns.factorymanager2.project.bean.ProductBean;
import com.cloudsigns.factorymanager2.project.utils.ConstantUtil;
import com.cloudsigns.factorymanager2.project.utils.FileUtil;

import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import de.greenrobot.event.EventBus;

public class AddEngineeringFeedBackActivity1
//        extends BaseActivity
//        implements AdapterView.OnItemClickListener, BottomListDialog.OnItemDialogClick, IUploadPhotoView, IUnusualDailyFeedBackForInstallView,
//        INormalDailyFeedBackForInstallView, IUnusualFeedBackForLogisticsDelayView, IUnusualFeedBackForLogisticsCargoView, IUnusualFeedBackForDamageView
{

//    private final String TAG = AddEngineeringFeedBackActivity1.class.getSimpleName();
//    private RelativeLayout rl_back;
//    private TextView tv_title;
//    private RadioGroup rg_feedback_type;
//    private RadioButton rb_feedback_normal, rb_feedback_abnormal;
//    private RelativeLayout rl_normal_feedback;
//    private final int NORMAL_FEEDBACK = 1;
//    private final int UNSUAL_FEEDBACK = 2;
//    private int feedBackType = NORMAL_FEEDBACK;
//
//    private RadioGroup rg_normal_feedback;
//    private RadioButton rb_normal_engineering, rb_normal_logistics;
//    private LinearLayout ll_normal_engineering;
//    private RelativeLayout rl_normal_logistics;
//    private final int NORMAL_EDGINEERING = 1;
//    private final int NORMAL_LOGISTICS = 2;
//    private int normalType = NORMAL_EDGINEERING;
//
//    private EditText edt_feedback_status;
//    private ImageView img_feedback_status;F
//    private ImageView img_xianchang_picture;
//
//    private EditText edt_feedback_content;
//    private ImageView img_feedback_content;
//
//    private RelativeLayout rl_unusual_feedback;
//    private RadioButton cb_install_unusual, cb_logistics_delay, cb_omit, cb_damage;
//
//    private RelativeLayout rl_install_unusual;
//    private EditText edt_unusual_reason_install;
//    private ImageView img_unusual_reason_install_right;
//    private EditText edt_unusual_adviece_install;
//    private ImageView img_unusual_adviece_install_right;
//    private TextView edt_impact_install;
//    private ImageView img_impact_install_right;
//    private View rl_img_install;
//    private ImageView img_install;
//
//    private RelativeLayout rl_logistics_delay;
//    private EditText edt_delay_days;
//    private TextView edt_impact;
//    private ImageView img_impact_right;
//
//    private RelativeLayout rl_omit;
//    private EditText edt_omit_tent;
//    private ImageView img_omit_tent_right;
//    private EditText edt_cargo_number;
//    private EditText edt_unusual_adviece;
//    private ImageView img_unusual_adviece_right;
//    private TextView edt_cargo_impact;
//    private ImageView img_cargo_impact_right;
//    private View rl_img_omit;
//    private ImageView img_omit;
//
//    private RelativeLayout rl_damage;
//    private TextView edt_damage_product;
//    private ImageView img_damage_product_right;
//    private EditText edt_damage_number;
//    private TextView edt_damage_unusual_adviece;
//    private ImageView img_damage_unusual_adviece_right;
//    private TextView edt_damage_impact;
//    private ImageView img_damage_impact_right;
//    private View rl_img_damange;
//    private ImageView img_damage;
//
//    private final int DELAY = 0;
//    private final int OMIT = 1;
//    private final int DAMAGE = 2;
//    private final int INSTALL_UNUSUAL = 3;
//    private int unusual_type = DELAY;
//    private int damage_pop;
//    private int DAMAGE_PRODUCT_POP = 1;
//    private int DAMAGE_ADVICE_POP = 2;
//    private int DAMAGE_IMPACT_POP = 3;
//
//    private int install_pop;
//    private int INSTALL_ADVICE_POP = 1;
//    private int INSTALL_IMPACT_POP = 2;
//    private int omit_pop;
//    private int OMIT_TENT_POP = 1;
//    private int OMIT_ADVIECE_POP = 2;
//    private int OMIT_IMPACT_POP = 3;
//
//
//    private TextView btn_upload;
//
//    private EngineeringInstallationOrderBean engineeringInstallationOrderBean;
//    private SpinerPopWindow<String> mSpinerPopWindow, fbContentSpinerPopWindow, productPopWindow, delayDaysPopWindow, impactPopWindow, omitTentPopWindow, omitDvicePopWindow;
//    private PopWindowAdapter popWindowAdapter, fbContentPopWindowAdapter, productAdapter, delayDaysPopWindowAdapter, impactPopWindowAdapter, omitTentAdapter, omitDviceAdapter;
//    private List<String> popStrLs = new ArrayList<String>();
//    private List<String> popFbContentStrLs = new ArrayList<String>();
//
//    private String filePath;
//    private List<String> imgUrlNormalList = new ArrayList<>();
//    private List<String> imgUrlOmitList = new ArrayList<>();
//    private List<String> imgUrlDamageList = new ArrayList<>();
//    private List<String> imgUrlInstallList = new ArrayList<>();
//    private List<String> popDelayDaysStrLs = new ArrayList<String>();
//    private List<String> productStrLs = new ArrayList<String>();
//    private List<String> popImpactStrLs = new ArrayList<String>();
//    private List<String> omitTentStrLs = new ArrayList<String>();
//    private List<String> omitDviceStrLs = new ArrayList<String>();
//
//    private UploadPhotoPresenter uploadPhotoPresenter;
//    private UnusualFeedBackForInstallPrsenter unusualFeedBackForInstallPrsenter;
//    private UnusualFeedBackForLogisticsDelayPrsenter unusualFeedBackForLogisticsDelayPrsenter;
//    private UnusualFeedBackForLogisticsCargoPrsenter unusualFeedBackForLogisticsCargoPrsenter;
//    private UnusualFeedBackForDamagePrsenter unusualFeedBackForDamagePrsenter;
//    private NormalFeedBackForInstallPresenter normalFeedBackForInstallPresenter;
//
//    @Override
//    protected void onBaseCreate(Bundle savedInstanceState) {
//        setContentView(R.layout.layout_add_engineering_feed_back1);
//    }
//
//    @Override
//    protected void initView(Bundle savedInstanceState) {
//        rl_back = (RelativeLayout) findViewById(R.id.rl_back);
//        tv_title = (TextView) findViewById(R.id.tv_title);
//        rg_feedback_type = findViewById(R.id.rg_feedback_type);
//        rb_feedback_normal = findViewById(R.id.rb_feedback_normal);
//        rb_feedback_abnormal = findViewById(R.id.rb_feedback_abnormal);
//        rl_normal_feedback = findViewById(R.id.rl_normal_feedback);
//        rg_normal_feedback = findViewById(R.id.rg_normal_feedback);
//        rb_normal_engineering = findViewById(R.id.rb_normal_engineering);
//        rb_normal_logistics = findViewById(R.id.rb_normal_logistics);
//        ll_normal_engineering = findViewById(R.id.ll_normal_engineering);
//        rl_normal_logistics = findViewById(R.id.rl_normal_logistics);
//        edt_feedback_status = findViewById(R.id.edt_feedback_status);
//        img_feedback_status = findViewById(R.id.img_feedback_status);
//        img_xianchang_picture = findViewById(R.id.img_xianchang_picture);
//        edt_feedback_content = findViewById(R.id.edt_feedback_content);
//        img_feedback_content = findViewById(R.id.img_feedback_content);
//        rl_unusual_feedback = findViewById(R.id.rl_unusual_feedback);
//        cb_install_unusual = (RadioButton) findViewById(R.id.cb_install_unusual);
//        cb_logistics_delay = (RadioButton) findViewById(R.id.cb_logistics_delay);
//        cb_omit = (RadioButton) findViewById(R.id.cb_omit);
//        cb_damage = (RadioButton) findViewById(R.id.cb_damage);
//        rl_install_unusual = findViewById(R.id.rl_install_unusual);
//        edt_unusual_reason_install = findViewById(R.id.edt_unusual_reason_install);
//        img_unusual_reason_install_right = findViewById(R.id.img_unusual_reason_install_right);
//        edt_unusual_adviece_install = findViewById(R.id.edt_unusual_adviece_install);
//        img_unusual_adviece_install_right = findViewById(R.id.img_unusual_adviece_install_right);
//        edt_impact_install = findViewById(R.id.edt_impact_install);
//        img_impact_install_right = findViewById(R.id.img_impact_install_right);
//        rl_img_install = findViewById(R.id.rl_img_install);
//        img_install = findViewById(R.id.img_install);
//        rl_logistics_delay = findViewById(R.id.rl_logistics_delay);
//        edt_delay_days = findViewById(R.id.edt_delay_days);
//        rl_omit = findViewById(R.id.rl_omit);
//        edt_impact = findViewById(R.id.edt_impact);
//        img_impact_right = findViewById(R.id.img_impact_right);
//        edt_omit_tent = findViewById(R.id.edt_omit_tent);
//        img_omit_tent_right = findViewById(R.id.img_omit_tent_right);
//        edt_cargo_number = findViewById(R.id.edt_cargo_number);
//        edt_unusual_adviece = findViewById(R.id.edt_unusual_adviece);
//        img_unusual_adviece_right = findViewById(R.id.img_unusual_adviece_right);
//        edt_cargo_impact = findViewById(R.id.edt_cargo_impact);
//        img_cargo_impact_right = findViewById(R.id.img_cargo_impact_right);
//        rl_img_omit = findViewById(R.id.rl_img_omit);
//        img_omit = findViewById(R.id.img_omit);
//
//        rl_damage = findViewById(R.id.rl_damage);
//        edt_damage_product = findViewById(R.id.edt_damage_product);
//        img_damage_product_right = findViewById(R.id.img_damage_product_right);
//        edt_damage_number = findViewById(R.id.edt_damage_number);
//        edt_damage_unusual_adviece = findViewById(R.id.edt_damage_unusual_adviece);
//        img_damage_unusual_adviece_right = findViewById(R.id.img_damage_unusual_adviece_right);
//        edt_damage_impact = findViewById(R.id.edt_damage_impact);
//        img_damage_impact_right = findViewById(R.id.img_damage_impact_right);
//        rl_img_damange = findViewById(R.id.rl_img_damange);
//        img_damage = findViewById(R.id.img_damage);
//
//
//        btn_upload = findViewById(R.id.btn_upload);
//    }
//
//    @Override
//    protected void initData(Bundle savedInstanceState) {
//        tv_title.setText(getResources().getText(R.string.daily_feed_back));
//
//        if (null != getIntent()) {
//            engineeringInstallationOrderBean = (EngineeringInstallationOrderBean) getIntent().getSerializableExtra(ConstantUtil.KEY_1);
//        }
//
//        uploadPhotoPresenter = new UploadPhotoPresenter(this);
//        unusualFeedBackForInstallPrsenter = new UnusualFeedBackForInstallPrsenter(this);
//        unusualFeedBackForLogisticsDelayPrsenter = new UnusualFeedBackForLogisticsDelayPrsenter(this);
//        unusualFeedBackForLogisticsCargoPrsenter = new UnusualFeedBackForLogisticsCargoPrsenter(this);
//        unusualFeedBackForDamagePrsenter = new UnusualFeedBackForDamagePrsenter(this);
//        normalFeedBackForInstallPresenter = new NormalFeedBackForInstallPresenter(this);
//
//
//        // 状态反馈
//        mSpinerPopWindow = new SpinerPopWindow<String>(this, this);
//        popWindowAdapter = new PopWindowAdapter(this, TAG);
//        popStrLs.add("安装进行中");
//        popStrLs.add("施工协调中");
//        popStrLs.add("等待货物");
//        popStrLs.add("完成");
//        popWindowAdapter.setData(popStrLs);
//        mSpinerPopWindow.setAdapter(popWindowAdapter);
//
//        // 反馈内容
//        fbContentSpinerPopWindow = new SpinerPopWindow<String>(this, this);
//        fbContentPopWindowAdapter = new PopWindowAdapter(this, TAG);
//        popFbContentStrLs.add("要求日期到货");
//        popFbContentStrLs.add("提前到货");
//        popFbContentStrLs.add("在可接受内范围到货");
//        fbContentPopWindowAdapter.setData(popFbContentStrLs);
//        fbContentSpinerPopWindow.setAdapter(fbContentPopWindowAdapter);
//
//        // 损坏产品
//        productPopWindow = new SpinerPopWindow<String>(this, this);
//        productAdapter = new PopWindowAdapter(this, TAG);
//        if (null != engineeringInstallationOrderBean) {
//            List<ProductBean> productBeanList = engineeringInstallationOrderBean.getProductList();
//            if (null != productBeanList) {
//                for (ProductBean productBean : productBeanList) {
//                    productStrLs.add(productBean.getName());
//                }
//            }
//        }
//        if (productStrLs.size() == 0) {
//            productStrLs.add("无产品");
//        }
//        productAdapter.setData(productStrLs);
//        productPopWindow.setAdapter(productAdapter);
//
//        // 物流漏货
//        omitDvicePopWindow = new SpinerPopWindow<String>(this, this);
//        omitDviceAdapter = new PopWindowAdapter(this, TAG);
//        omitDviceStrLs.add("重新发货");
//        omitDviceStrLs.add("现场制作");
//        omitDviceStrLs.add("现场修补");
//        omitDviceStrLs.add("现场购买");
//        omitDviceAdapter.setData(omitDviceStrLs);
//        omitDvicePopWindow.setAdapter(omitDviceAdapter);
//
//        // 物流延误
//        delayDaysPopWindow = new SpinerPopWindow<String>(this, this);
//        delayDaysPopWindowAdapter = new PopWindowAdapter(this, TAG);
//        popDelayDaysStrLs.add("1");
//        popDelayDaysStrLs.add("2");
//        delayDaysPopWindowAdapter.setData(popDelayDaysStrLs);
//        delayDaysPopWindow.setAdapter(delayDaysPopWindowAdapter);
//
//        // 调整天数
//        impactPopWindow = new SpinerPopWindow<String>(this, this);
//        impactPopWindowAdapter = new PopWindowAdapter(this, TAG);
//        popImpactStrLs.add("0");
//        popImpactStrLs.add("1");
//        popImpactStrLs.add("2");
//        popImpactStrLs.add("3");
//        popImpactStrLs.add("4");
//        popImpactStrLs.add("5");
//        popImpactStrLs.add("6");
//        popImpactStrLs.add("7");
//        impactPopWindowAdapter.setData(popImpactStrLs);
//        impactPopWindow.setAdapter(impactPopWindowAdapter);
//    }
//
//    @Override
//    public void setListener() {
//        rl_back.setOnClickListener(this);
//        img_feedback_status.setOnClickListener(this);
//        img_xianchang_picture.setOnClickListener(this);
//        img_feedback_content.setOnClickListener(this);
//        btn_upload.setOnClickListener(this);
//        cb_install_unusual.setOnClickListener(this);
//        cb_logistics_delay.setOnClickListener(this);
//        cb_omit.setOnClickListener(this);
//        cb_damage.setOnClickListener(this);
//        img_damage_product_right.setOnClickListener(this);
//        img_damage_impact_right.setOnClickListener(this);
//        img_unusual_reason_install_right.setOnClickListener(this);
//        img_unusual_adviece_install_right.setOnClickListener(this);
//        rl_img_install.setOnClickListener(this);
//        rl_img_damange.setOnClickListener(this);
//        img_unusual_adviece_right.setOnClickListener(this);
//        img_omit_tent_right.setOnClickListener(this);
//        img_cargo_impact_right.setOnClickListener(this);
//        rl_img_omit.setOnClickListener(this);
//        img_impact_install_right.setOnClickListener(this);
//
//        // 反馈类型：
//        rb_feedback_normal.setChecked(true);
//        rg_feedback_type.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
//            @Override
//            public void onCheckedChanged(RadioGroup radioGroup, @IdRes int id) {
//                if (id == R.id.rb_feedback_normal) {
//                    feedBackType = NORMAL_FEEDBACK;
//                    updateTypeUI();
//
//                } else if (id == R.id.rb_feedback_abnormal) {
//                    feedBackType = UNSUAL_FEEDBACK;
//                    updateTypeUI();
//                }
//            }
//        });
//
//        // 正常反馈
//        rb_normal_engineering.setChecked(true);
//        rg_normal_feedback.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
//            @Override
//            public void onCheckedChanged(RadioGroup radioGroup, @IdRes int id) {
//                if (id == R.id.rb_normal_engineering) {
//                    normalType = NORMAL_EDGINEERING;
//                    updateNormalUI();
//
//                } else if (id == R.id.rb_normal_logistics) {
//                    feedBackType = NORMAL_LOGISTICS;
//                    updateNormalUI();
//                }
//            }
//        });
//    }
//
//    // 反馈类型：
//    private void updateTypeUI() {
//        if (feedBackType == NORMAL_FEEDBACK) {// 正常反馈
//            rl_normal_feedback.setVisibility(View.VISIBLE);
//            rl_unusual_feedback.setVisibility(View.GONE);
//        } else if (feedBackType == UNSUAL_FEEDBACK) {// 异常反馈
//            rl_normal_feedback.setVisibility(View.GONE);
//            rl_unusual_feedback.setVisibility(View.VISIBLE);
//        }
//    }
//
//    // 正常反馈
//    private void updateNormalUI() {
//        if (normalType == NORMAL_EDGINEERING) {// 工程
//            ll_normal_engineering.setVisibility(View.VISIBLE);
//            rl_normal_logistics.setVisibility(View.GONE);
//        } else if (normalType == NORMAL_LOGISTICS) {// 物流
//            ll_normal_engineering.setVisibility(View.GONE);
//            rl_normal_logistics.setVisibility(View.VISIBLE);
//        }
//    }
//
//    // 状态反馈
//    private void showStatusPopWindow() {
//        mSpinerPopWindow.setWidth(edt_feedback_status.getWidth());
//        mSpinerPopWindow.showAsDropDown(edt_feedback_status);
//    }
//
//    // 反馈内容
//    private void showContentPopWindow() {
//        fbContentSpinerPopWindow.setWidth(edt_feedback_content.getWidth());
//        fbContentSpinerPopWindow.showAsDropDown(edt_feedback_content);
//    }
//
//    // 现场照片
//    private void showListDialog() {
//        DialogItemBean[] items = new DialogItemBean[]{
//                new DialogItemBean(R.string.camera,
//                        R.layout.dialog_list_item_normal),
//                new DialogItemBean(R.string.gallary,
//                        R.layout.dialog_list_item_normal),
//                new DialogItemBean(R.string.cancel,
//                        R.layout.dialog_list_item_normal)};
//        BottomListDialog dialog = new BottomListDialog(this, Arrays.asList(items));
//        dialog.setItemClick(this);
//        dialog.show();
//    }
//
//    // 异常反馈
//    private void updateUnusualContent() {
//        if (unusual_type == INSTALL_UNUSUAL) { // 安装异常
//            cb_logistics_delay.setChecked(false);
//            cb_omit.setChecked(false);
//            cb_damage.setChecked(false);
//            cb_install_unusual.setChecked(true);
//
//            rl_logistics_delay.setVisibility(View.GONE);
//            rl_damage.setVisibility(View.GONE);
//            rl_omit.setVisibility(View.GONE);
//            rl_install_unusual.setVisibility(View.VISIBLE);
//
//        } else if (unusual_type == DELAY) {// 物流延误
//            cb_logistics_delay.setChecked(true);
//            cb_omit.setChecked(false);
//            cb_damage.setChecked(false);
//            cb_install_unusual.setChecked(false);
//
//            rl_logistics_delay.setVisibility(View.VISIBLE);
//            rl_damage.setVisibility(View.GONE);
//            rl_omit.setVisibility(View.GONE);
//            rl_install_unusual.setVisibility(View.GONE);
//
//        } else if (unusual_type == OMIT) { // 物流漏货
//            cb_logistics_delay.setChecked(false);
//            cb_omit.setChecked(true);
//            cb_damage.setChecked(false);
//            cb_install_unusual.setChecked(false);
//
//            rl_logistics_delay.setVisibility(View.GONE);
//            rl_damage.setVisibility(View.GONE);
//            rl_omit.setVisibility(View.VISIBLE);
//            rl_install_unusual.setVisibility(View.GONE);
//
//        } else if (unusual_type == DAMAGE) {// 物流货损
//            cb_logistics_delay.setChecked(false);
//            cb_omit.setChecked(false);
//            cb_damage.setChecked(true);
//            cb_install_unusual.setChecked(false);
//
//            rl_logistics_delay.setVisibility(View.GONE);
//            rl_damage.setVisibility(View.VISIBLE);
//            rl_omit.setVisibility(View.GONE);
//            rl_install_unusual.setVisibility(View.GONE);
//
//        } else {
//            cb_logistics_delay.setChecked(false);
//            cb_omit.setChecked(false);
//            cb_damage.setChecked(false);
//            cb_install_unusual.setChecked(false);
//
//            rl_logistics_delay.setVisibility(View.GONE);
//            rl_damage.setVisibility(View.GONE);
//            rl_omit.setVisibility(View.GONE);
//            rl_install_unusual.setVisibility(View.GONE);
//        }
//    }
//
//    // 损坏产品
//    private void showProductPopWindow() {
//        if (unusual_type == DAMAGE) {
//            productPopWindow.setWidth(edt_damage_product.getWidth());
//            productPopWindow.showAsDropDown(edt_damage_product);
//        }
//    }
//
//    // 异常建议
//    private void showOmitAdvicePopWindow() {
//        if (unusual_type == OMIT) { // 物流漏货
//            omitDvicePopWindow.setWidth(edt_unusual_adviece.getWidth());
//            omitDvicePopWindow.showAsDropDown(edt_unusual_adviece);
//        } else if (unusual_type == DAMAGE) { // 物流货损
//            omitDvicePopWindow.setWidth(edt_damage_unusual_adviece.getWidth());
//            omitDvicePopWindow.showAsDropDown(edt_damage_unusual_adviece);
//        } else if (unusual_type == INSTALL_UNUSUAL) { // 安装异常
//            omitDvicePopWindow.setWidth(edt_unusual_adviece_install.getWidth());
//            omitDvicePopWindow.showAsDropDown(edt_unusual_adviece_install);
//        }
//    }
//
//    // 造成影响
//    private void showImpactPopWindow() {
//        if (unusual_type == DELAY) { // 物流延误
//            impactPopWindow.setWidth(edt_impact.getWidth());
//            impactPopWindow.showAsDropDown(edt_impact);
//        }
//
//        if (unusual_type == OMIT) { // 物流漏货
//            impactPopWindow.setWidth(edt_cargo_impact.getWidth());
//            impactPopWindow.showAsDropDown(edt_cargo_impact);
//        }
//
//        if (unusual_type == DAMAGE) { // 物流货损
//            impactPopWindow.setWidth(edt_damage_impact.getWidth());
//            impactPopWindow.showAsDropDown(edt_damage_impact);
//        }
//
//        if (unusual_type == INSTALL_UNUSUAL) { // 安装异常
//            impactPopWindow.setWidth(edt_impact_install.getWidth());
//            impactPopWindow.showAsDropDown(edt_impact_install);
//        }
//
//    }
//
//    // 物流漏货 遗漏内容
//    private void showOmitTentPopWindow() {
//        if (unusual_type == OMIT) {
//            omitTentPopWindow.setWidth(edt_omit_tent.getWidth());
//            omitTentPopWindow.showAsDropDown(edt_omit_tent);
//        }
//    }
//
//    // 提交
//    private void submitFeedBack() {
//        if (feedBackType == NORMAL_FEEDBACK) {
//            normalFeedBackForInstallPresenter.submitNormalFeedBackForInstall();
//
//        } else if (feedBackType == UNSUAL_FEEDBACK) {
//            switch (unusual_type) {
//                case DELAY:
//                    unusualFeedBackForLogisticsDelayPrsenter.submitUnusualFeedBackForLogisticsDelay();
//                    break;
//                case OMIT:
//                    unusualFeedBackForLogisticsCargoPrsenter.submitUnusualFeedBackForLogisticsCargo();
//                    break;
//                case DAMAGE:
//                    unusualFeedBackForDamagePrsenter.submitUnusualFeedBackForDamage();
//                    break;
//                case INSTALL_UNUSUAL:
//                    unusualFeedBackForInstallPrsenter.submitUnusualFeedBackForInstall();
//                    break;
//            }
//        }
//    }
//
//    @Override
//    public void widgetClick(View v) {
//        switch (v.getId()) {
//            case R.id.rl_back:
//                finish();
//                break;
//            // 状态反馈
//            case R.id.img_feedback_status:
//                showStatusPopWindow();
//                break;
//            // 正常反馈 工程 现场照片
//            case R.id.img_xianchang_picture:
//                showListDialog();
//                break;
//            // 正常反馈 工程 反馈内容
//            case R.id.img_feedback_content:
//                showContentPopWindow();
//                break;
//            // 安装异常
//            case R.id.cb_install_unusual:
//                if (unusual_type == INSTALL_UNUSUAL) {
//                    cb_install_unusual.setChecked(false);
//                    unusual_type = -1;
//                } else {
//                    cb_install_unusual.setChecked(true);
//                    unusual_type = INSTALL_UNUSUAL;
//                }
//                updateUnusualContent();
//                break;
//            // 物流延误
//            case R.id.cb_logistics_delay:
//                if (unusual_type == DELAY) {
//                    cb_logistics_delay.setChecked(false);
//                    unusual_type = -1;
//                } else {
//                    cb_logistics_delay.setChecked(true);
//                    unusual_type = DELAY;
//                }
//                updateUnusualContent();
//                break;
//            // 物流漏货
//            case R.id.cb_omit:
//                if (unusual_type == OMIT) {
//                    cb_omit.setChecked(false);
//                    unusual_type = -1;
//                } else {
//                    cb_omit.setChecked(true);
//                    unusual_type = OMIT;
//                }
//                updateUnusualContent();
//                break;
//            // 物流货损
//            case R.id.cb_damage:
//                if (unusual_type == DAMAGE) {
//                    cb_damage.setChecked(false);
//                    unusual_type = -1;
//                } else {
//                    cb_damage.setChecked(true);
//                    unusual_type = DAMAGE;
//                }
//                updateUnusualContent();
//                break;
//            // 安装异常 异常原因
//            case R.id.img_unusual_reason_install_right:
//                break;
//            // 安装异常 安装建议
//            case R.id.img_unusual_adviece_install_right:
//                install_pop = INSTALL_ADVICE_POP;
//                showOmitAdvicePopWindow();
//                break;
//            // 安装异常 造成影响
//            case R.id.img_impact_install_right:
//                install_pop = INSTALL_IMPACT_POP;
//                showImpactPopWindow();
//                break;
//            // 安装异常 现场照片
//            case R.id.rl_img_install:
//                showListDialog();
//                break;
//            // 物流延误 造成影响
//            case R.id.img_impact_right:
//                showImpactPopWindow();
//                break;
//            // 物流漏货 遗漏内容
//            case R.id.img_omit_tent_right:
//                omit_pop = OMIT_TENT_POP;
//                showOmitTentPopWindow();
//                break;
//            // 物流漏货 异常建议
//            case R.id.img_unusual_adviece_right:
//                omit_pop = OMIT_ADVIECE_POP;
//                showOmitAdvicePopWindow();
//                break;
//            // 物流漏货 造成影响
//            case R.id.img_cargo_impact_right:
//                omit_pop = OMIT_IMPACT_POP;
//                showImpactPopWindow();
//                break;
//            // 物流漏货 现场照片
//            case R.id.rl_img_omit:
//                showListDialog();
//                break;
//            // 物流货损 损坏产品
//            case R.id.img_damage_product_right:
//                showProductPopWindow();
//                break;
//            // 物流货损 异常建议
//            case R.id.img_damage_unusual_adviece_right:
//                damage_pop = DAMAGE_ADVICE_POP;
//                showOmitAdvicePopWindow();
//                break;
//            // 物流货损 造成影响
//            case R.id.img_damage_impact_right:
//                damage_pop = DAMAGE_IMPACT_POP;
//                showImpactPopWindow();
//                break;
//            // 物流货损 现场照片
//            case R.id.rl_img_damange:
//                showListDialog();
//                break;
//            // 提交
//            case R.id.btn_upload:
//                submitFeedBack();
//                break;
//        }
//    }
//
//    @Override
//    public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
//        if (feedBackType == NORMAL_FEEDBACK) {
//            if (normalType == NORMAL_EDGINEERING) {
//                edt_feedback_status.setText(popStrLs.get(i));
//                edt_feedback_status.setSelection(popStrLs.get(i).length());
//            }
//            if (normalType == NORMAL_LOGISTICS) {
//                edt_feedback_content.setText(popFbContentStrLs.get(i));
//                edt_feedback_content.setSelection(popFbContentStrLs.get(i).length());
//            }
//        }
//
//        if (feedBackType == UNSUAL_FEEDBACK) {
//            if (unusual_type == DELAY) {
//                edt_impact.setText(popImpactStrLs.get(i));
//            }
//
//            if (unusual_type == OMIT) {
//                if (omit_pop == OMIT_TENT_POP) {
//                    edt_omit_tent.setText(omitTentStrLs.get(i));
//                } else if (omit_pop == OMIT_ADVIECE_POP) {
//                    edt_unusual_adviece.setText(omitDviceStrLs.get(i));
//                } else if (omit_pop == OMIT_IMPACT_POP) {
//                    edt_cargo_impact.setText(popImpactStrLs.get(i));
//                }
//            }
//
//            if (unusual_type == DAMAGE) {
//                if (damage_pop == DAMAGE_PRODUCT_POP)
//                    edt_damage_product.setText(productStrLs.get(i));
//                else if (damage_pop == DAMAGE_ADVICE_POP)
//                    edt_damage_unusual_adviece.setText(omitDviceStrLs.get(i));
//                else if (damage_pop == DAMAGE_IMPACT_POP)
//                    edt_damage_impact.setText(popImpactStrLs.get(i));
//
//            }
//
//            if (unusual_type == INSTALL_UNUSUAL) {
//                if (install_pop == INSTALL_ADVICE_POP)
//                    edt_unusual_adviece_install.setText(omitDviceStrLs.get(i));
//                else if (install_pop == INSTALL_IMPACT_POP)
//                    edt_impact_install.setText(popImpactStrLs.get(i));
//            }
//        }
//
//        if (null != mSpinerPopWindow)
//            mSpinerPopWindow.dismiss();
//        if (null != delayDaysPopWindow)
//            delayDaysPopWindow.dismiss();
//        if (null != omitTentPopWindow)
//            omitTentPopWindow.dismiss();
//
//        if (null != impactPopWindow)
//            impactPopWindow.dismiss();
//        if (null != omitDvicePopWindow)
//            omitDvicePopWindow.dismiss();
//
//        if (null != productPopWindow)
//            productPopWindow.dismiss();
//
//    }
//
//    @Override
//    public void onItemDialogClick(DialogItemBean item) {
//        switch (item.getmTextId()) {
//            case R.string.camera: {
//                PhotoUtil.startCamear(AddEngineeringFeedBackActivity1.this, null);
//                break;
//            }
//            case R.string.gallary: {
//                PhotoUtil.startGallery(AddEngineeringFeedBackActivity1.this, null);
//                break;
//            }
//            default:
//                break;
//        }
//    }
//
//    @Override
//    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
//        if (null != data) {
//            switch (requestCode) {
//                case PhotoUtil.CAMERA:
//                    if (resultCode == RESULT_OK) {
//                        File picture = new File(PhotoUtil.filePath);
//                        if (!picture.exists()) {
//                            picture = new File(PhotoUtil.filePath);
//                        }
//                        filePath = PhotoUtil.CAMERA_SEVER + picture.getName();
//                        filePath = PhotoUtil.imageCompressionAndSave(picture.getAbsolutePath(), filePath);
//
//                        if (feedBackType == NORMAL_FEEDBACK) {
//                            Glide.with(this).load(picture).asBitmap().into(img_xianchang_picture);
//                        } else if (feedBackType == UNSUAL_FEEDBACK) {
//                            switch (unusual_type) {
//                                case DELAY:
//                                    break;
//                                case OMIT:
//                                    Glide.with(this).load(picture).asBitmap().into(img_omit);
//                                    break;
//                                case DAMAGE:
//                                    Glide.with(this).load(picture).asBitmap().into(img_damage);
//                                    break;
//                                case INSTALL_UNUSUAL:
//                                    Glide.with(this).load(picture).asBitmap().into(img_install);
//                                    break;
//                            }
//                        }
//                        uploadPhotoPresenter.uploadPhtoto();
//                    }
//                    break;
//
//                case PhotoUtil.GALLERY:
//                    if (resultCode == RESULT_OK) {
//                        if (feedBackType == NORMAL_FEEDBACK) {
//                            Glide.with(this).load(data.getData()).asBitmap().into(img_xianchang_picture);
//                        } else if (feedBackType == UNSUAL_FEEDBACK) {
//                            switch (unusual_type) {
//                                case DELAY:
//                                    break;
//                                case OMIT:
//                                    Glide.with(this).load(data.getData()).asBitmap().into(img_omit);
//                                    break;
//                                case DAMAGE:
//                                    Glide.with(this).load(data.getData()).asBitmap().into(img_damage);
//                                    break;
//                                case INSTALL_UNUSUAL:
//                                    Glide.with(this).load(data.getData()).asBitmap().into(img_install);
//                                    break;
//                            }
//                        }
//                        String path = FileUtil.getRealPathFromURI(this, Uri.parse(data.getData() + ""));
//                        File f = new File(path);
//                        filePath = PhotoUtil.CAMERA_SEVER + f.getName();
//                        filePath = PhotoUtil.imageCompressionAndSave(path, filePath);
//                        uploadPhotoPresenter.uploadPhtoto();
//                    }
//                    break;
//                case PhotoUtil.PHOTORESOULT:
//                    break;
//            }
//        }
//        super.onActivityResult(requestCode, resultCode, data);
//    }
//
//    @Override
//    public String getFilePath() {
//        return filePath;
//    }
//
//    @Override
//    public void upLoadPhotoSuccessed(String uri) {
//        if (feedBackType == NORMAL_FEEDBACK) {
//            imgUrlNormalList.clear();
//            imgUrlNormalList.add(uri);
//        }
//    }
//
//    @Override
//    public void upLoadPhotoFailed(String desc) {
//
//    }
//
//    @Override
//    public String getStatus() {
//        return edt_feedback_status.getText().toString().trim();
//    }
//
//    @Override
//    public void submitNormalFeedBackForInstallSuccessed() {
//        Toast.makeText(this, "正常反馈成功！", Toast.LENGTH_SHORT).show();
//        EventBus.getDefault().post(new EngineeringOrderDetailForTeamEvent());
//        finish();
//    }
//
//    @Override
//    public void submitNormalFeedBackForInstallFailed(String desc) {
//        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
//    }
//
//    @Override
//    public String getAdvice() {
//        if (unusual_type == OMIT)
//            return edt_unusual_adviece.getText().toString().trim();
//        else if (unusual_type == DAMAGE)
//            return edt_damage_unusual_adviece.getText().toString().trim();
//        else if (unusual_type == INSTALL_UNUSUAL)
//            return edt_unusual_adviece_install.getText().toString().trim();
//        return "";
//    }
//
//    @Override
//    public int getDamageNumber() {
//        String str = edt_damage_number.getText().toString().trim();
//        if (null != str && !TextUtils.isEmpty(str))
//            return Integer.parseInt(str);
//        return 0;
//    }
//
//    @Override
//    public String getDamageProduct() {
//        return edt_damage_product.getText().toString().trim();
//    }
//
//    @Override
//    public int getDelayDays() {
//        int day = 0;
//        if (unusual_type == DELAY) {
//            String str = edt_delay_days.getText().toString().trim();
//            if (null == str || TextUtils.isEmpty(str)) {
//            } else {
//                day = Integer.parseInt(str);
//            }
//        }
//        return day;
//    }
//
//    @Override
//    public String getId() {
//        if (null != engineeringInstallationOrderBean)
//            return engineeringInstallationOrderBean.getId();
//        return "";
//    }
//
//    @Override
//    public List<String> getImgUrlList() {
//        if (feedBackType == NORMAL_FEEDBACK) {
//            return imgUrlNormalList;
//
//        } else if (feedBackType == UNSUAL_FEEDBACK) {
//            if (unusual_type == OMIT) {
//                return imgUrlOmitList;
//            } else if (unusual_type == DAMAGE) {
//                return imgUrlDamageList;
//            } else if (unusual_type == INSTALL_UNUSUAL) {
//                return imgUrlInstallList;
//            }
//        }
//        return null;
//    }
//
//    @Override
//    public String getItemId() {
//        return null;
//    }
//
//    @Override
//    public String getOmitContent() {
//        return edt_omit_tent.getText().toString().trim();
//    }
//
//    @Override
//    public int getOmitNumber() {
//        String str = edt_cargo_number.getText().toString().trim();
//        if (null != str && !TextUtils.isEmpty(str))
//            return Integer.parseInt(str);
//        return 0;
//    }
//
//    @Override
//    public CommonEnum.EngineeringORderCategory getType() {
//        return CommonEnum.EngineeringORderCategory.INSTALL;
//    }
//
//    @Override
//    public int getUnusualDays() {
//        int day = 0;
//        if (unusual_type == DELAY) { // 物流延误
//            String str = edt_impact.getText().toString().trim();
//            if (null != str || !TextUtils.isEmpty(str))
//                day = Integer.parseInt(str);
//        }
//        if (unusual_type == OMIT) { // 物流漏货
//            String str = edt_cargo_impact.getText().toString().trim();
//            if (null != str || !TextUtils.isEmpty(str))
//                day = Integer.parseInt(str);
//        }
//        if (unusual_type == DAMAGE) { // 物流货损
//            String str = edt_damage_impact.getText().toString().trim();
//            if (null != str || !TextUtils.isEmpty(str))
//                day = Integer.parseInt(str);
//        }
//        if (unusual_type == INSTALL_UNUSUAL) { // 安装异常
//            String str = edt_impact_install.getText().toString().trim();
//            if (null != str || !TextUtils.isEmpty(str))
//                day = Integer.parseInt(str);
//        }
//        return day;
//    }
//
//    @Override
//    public void submitUnusualFeedBackForLogisticsDelaySuccessed() {
//        Toast.makeText(this, "物流延误反馈成功！", Toast.LENGTH_SHORT).show();
//        EventBus.getDefault().post(new EngineeringOrderDetailForTeamEvent());
//        finish();
//    }
//
//    @Override
//    public void submitUnusualFeedBackForLogisticsDelayFailed(String desc) {
//        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
//    }
//
//    @Override
//    public void submitUnusualFeedBackForLogisticsCargoSuccessed() {
//        Toast.makeText(this, "物流漏货反馈成功！", Toast.LENGTH_SHORT).show();
//        EventBus.getDefault().post(new EngineeringOrderDetailForTeamEvent());
//        finish();
//    }
//
//    @Override
//    public void submitUnusualFeedBackForLogisticsCargoFailed(String desc) {
//        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
//    }
//
//    @Override
//    public void submitUnusualFeedBackForDamageSunccessed() {
//        Toast.makeText(this, "物流货损反馈成功！", Toast.LENGTH_SHORT).show();
//        EventBus.getDefault().post(new EngineeringOrderDetailForTeamEvent());
//        finish();
//    }
//
//    @Override
//    public void submitUnusualFeedBackForDamageFailed(String desc) {
//        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
//    }
//
//    @Override
//    public String getUnusualReason() {
//        return edt_unusual_reason_install.getText().toString().trim();
//    }
//
//    @Override
//    public void submitUnusualFeedBackForInstallViewSuccessed() {
//        Toast.makeText(this, "安装异常反馈成功！", Toast.LENGTH_SHORT).show();
//        EventBus.getDefault().post(new EngineeringOrderDetailForTeamEvent());
//        finish();
//    }
//
//    @Override
//    public void submitUnusualFeedBackForInstallViewFailed(String desc) {
//        Toast.makeText(this, desc, Toast.LENGTH_SHORT).show();
//    }
//
//    @Override
//    public void showLoading() {
//
//    }
//
//    @Override
//    public void hideLoading() {
//
//    }
}
